package BiTree;

/**
 * @program: java_concurrent
 * @description: 输出完全二叉树的节点个数
 * @author: lxf
 * @create: 2024-06-28 15:22
 **/
public class CountNodes {
    public int countNodes(TreeNode root) {
        if (root == null) {
            return 0;
        }
        return countNodes(root.left)+countNodes(root.right) + 1;
    }
}
